/**indexOf */

// var arr=[1,2,3,4,5,{name:'张三'},null,undefined,'5'];
// console.log(arr.length);//数组长度为9
// // console.log(arr.indexOf({name:'张三'}));
// console.log(arr.indexOf(null));//返回6
// console.log(arr.indexOf(undefined));//返回7
// console.log(arr.indexOf(5));//返回4
// console.log(arr.indexOf('5'));//返回8

/**slice */

// var arr =[1,2,3,4,5,'www',{name:'你好'},'5'];

// console.log(arr);//返回arr数组中所有内容
// console.log(arr.slice());//复制arr数组

// var arr1=arr.slice();
// arr1[0]='www.baidu.com';
// console.log(arr1);//返回["www.baidu.com", 2, 3, 4, 5, "www", {name:'你好'}, "5"]
// console.log(arr);//返回[1,2,3,4,5,'www',{name:'你好'},'5'];
// console.log(arr.slice());//返回[1,2,3,4,5,'www',{name:'你好'},'5'];

/**pop和push */

var arr=[1,2,3];
arr.push('按时吃饭','早上好！');
console.log(arr);//返回[1, 2, 3, "按时吃饭", "早上好！"]

console.log(arr.pop());//返回‘早上好！’
console.log(arr);//返回[1, 2, 3, "按时吃饭"]
